<?php
class CronHist extends ModelBase
{
	private $tableName = 'cron_hist';
	
	public static function getInstance(){
		return parent::instance(__CLASS__);
	}

	public function getCount($cid){
		$user = Yii::app()->db->createCommand()
			->select('count(*) as num')
			->from($this->tableName)
			->where('cid='.$cid)
			->queryRow();
		return $user['num'];
	}
	
	public function getCronHist($cid,$offset=0,$pageSize = 10){
		$app = Yii::app()->db->createCommand()->select('*')->from($this->tableName)->limit($pageSize,$offset);
		$app->where('cid = '.$cid);
		$app = $app->queryAll();
		return $app;
	}
}